package com.aipartner.common;

import lombok.Getter;

/**
 * 结果状态码枚举
 * 
 * @author AI伙伴团队
 * @since 2024-01-20
 */
@Getter
public enum ResultCode {
    
    // 成功
    SUCCESS(200, "操作成功"),
    
    // 客户端错误
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权访问"),
    FORBIDDEN(403, "访问被禁止"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),
    CONFLICT(409, "数据冲突"),
    VALIDATION_ERROR(422, "参数校验失败"),
    TOO_MANY_REQUESTS(429, "请求过于频繁"),
    
    // 服务器错误
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    
    // 业务错误(1000-1999)
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_ALREADY_EXISTS(1002, "用户已存在"),
    INVALID_PASSWORD(1003, "密码错误"),
    USER_DISABLED(1004, "用户已被禁用"),
    TOKEN_EXPIRED(1005, "令牌已过期"),
    TOKEN_INVALID(1006, "令牌无效"),
    INSUFFICIENT_PERMISSIONS(1007, "权限不足"),
    
    // 微信相关错误(2000-2099)
    WECHAT_CODE_INVALID(2001, "微信授权码无效"),
    WECHAT_API_ERROR(2002, "微信API调用失败"),
    WECHAT_USER_INFO_ERROR(2003, "获取微信用户信息失败"),
    
    // AI相关错误(3000-3099)
    AI_MODEL_NOT_FOUND(3001, "AI模型不存在"),
    AI_MODEL_DISABLED(3002, "AI模型已禁用"),
    AI_API_ERROR(3003, "AI接口调用失败"),
    AI_QUOTA_EXCEEDED(3004, "AI调用额度已用完"),
    AI_CONTENT_FILTERED(3005, "内容被过滤"),
    
    // VIP相关错误(4000-4099)
    VIP_NOT_FOUND(4001, "VIP套餐不存在"),
    VIP_ALREADY_ACTIVE(4002, "VIP已激活"),
    VIP_EXPIRED(4003, "VIP已过期"),
    INSUFFICIENT_BALANCE(4004, "余额不足"),
    
    // 支付相关错误(5000-5099)
    PAYMENT_ORDER_NOT_FOUND(5001, "支付订单不存在"),
    PAYMENT_FAILED(5002, "支付失败"),
    PAYMENT_CANCELLED(5003, "支付已取消"),
    PAYMENT_TIMEOUT(5004, "支付超时"),
    REFUND_FAILED(5005, "退款失败"),
    
    // 文件相关错误(6000-6099)
    FILE_NOT_FOUND(6001, "文件不存在"),
    FILE_UPLOAD_ERROR(6002, "文件上传失败"),
    FILE_TYPE_NOT_ALLOWED(6003, "文件类型不允许"),
    FILE_SIZE_EXCEEDED(6004, "文件大小超限"),
    
    // 数据相关错误(7000-7099)
    DATA_NOT_FOUND(7001, "数据不存在"),
    DATA_ALREADY_EXISTS(7002, "数据已存在"),
    DATA_INTEGRITY_ERROR(7003, "数据完整性错误"),
    DATABASE_ERROR(7004, "数据库操作错误"),
    
    // 缓存相关错误(8000-8099)
    CACHE_ERROR(8001, "缓存操作失败"),
    CACHE_KEY_NOT_FOUND(8002, "缓存键不存在"),
    
    // 第三方服务错误码 (9000-9099)
    THIRD_PARTY_API_ERROR(9001, "第三方API调用失败"),
    SMS_SEND_ERROR(9002, "短信发送失败"),
    EMAIL_SEND_ERROR(9003, "邮件发送失败");
    
    private final Integer code;
    private final String message;
    
    /**
     * 构造函数
     */
    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
